package com.foreverwin.jzymes.archive.service;

import com.foreverwin.jzymes.archive.domain.DataArchive;
import com.foreverwin.jzymes.framework.annotation.DataSource;
import com.foreverwin.jzymes.framework.datasource.DataSourceType;

import java.util.List;
import java.util.Map;

public interface IDataArchiveAdviceService {

    public List<String> findTableFields(String table );

    @DataSource( value = DataSourceType.SLAVE )
    public List<String> findArchiveTableFields(String table );

    public List<DataArchive> findReferDataArchiveList(String table );

    @DataSource( value = DataSourceType.SLAVE )
    public int createArchiveTable( String table, String archiveTable );

    public int updateArchiveCount( String table, int increment );

    public List<Map<String,Object>> doQuery(Map<String,Object> paramMap );

    @DataSource( value = DataSourceType.SLAVE )
    public int doBatchInsertArchive( List<Map<String, Object>> dataList, String archiveTable, List<String> syncFields );

    @DataSource( value = DataSourceType.SLAVE )
    public void doBatchDeleteArchive( List<Map<String, Object>> dataList, String archiveTable, List<String> primaryKeys );

    public void doBatchDelete( List<Map<String, Object>> dataList, String table, List<String> primaryKeys );

    @DataSource( value = DataSourceType.SLAVE )
    public int doDeleteArchive( Map data, String archiveTable, String queryCriteria );

    @DataSource( value = DataSourceType.SLAVE )
    public int doInsert( Map<String, Object> paramMap );

    //构建ODS更新sql
    @DataSource( value = DataSourceType.SLAVE )
    public int doUpdate( Map<String, Object> paramMap );

    //构建WIP删除sql
    public int doDelete( Map<String, Object> paramMap );

    @DataSource( value = DataSourceType.SLAVE )
    public int doInsertArchive(  Map<String,Object> data, String archiveTable, List<String> syncFields );

    @DataSource( value = DataSourceType.SLAVE )
    public int doUpdateArchive( Map<String,Object> data, String archiveTable, List<String> syncFields, List<String> primaryKeys );

    public int doDelete( Map data, String table, List<String> primaryKeys );


    public void saveDataArchive( List<DataArchive> dataArchiveList );
}
